/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_Studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include "配置.h"

#include <UI/UI.h>



std::map<S_键位映射*, S_Props> C_键位映射配置::g_全局键位映射容器;
std::map<S_键位映射*, S_Props> C_键位映射配置::g_3D视口键位映射容器;
std::map<S_键位映射*, S_Props> C_键位映射配置::g_2D视口键位映射容器;
std::map<S_键位映射*, S_Props> C_键位映射配置::g_节点视口键位映射容器;



void f_配置_添加操作键位(S_键位映射* key, uint32 分组) {
	//g_全局键位映射容器.insert(key);
}


S_键位映射* f_配置_取操作键位(uint32 分组) {
	
	return nullptr;
}

C_键位映射配置::C_键位映射配置()
{
}

void C_键位映射配置::f_添加全局操作键位(S_键位映射* key, std::wstring name) {
	if (g_全局键位映射容器.find(key) == g_全局键位映射容器.end()) {
		S_Props prop = f_alloc_键位(key, name);

		g_全局键位映射容器[key] = prop;
		//f_ui_注册全局快捷键(key);
	}

	C_Widget::G键位映射容器.insert(key);
}

void C_键位映射配置::f_添加3D视口操作键位(S_键位映射* key, std::wstring name) {
	if (g_3D视口键位映射容器.find(key) == g_3D视口键位映射容器.end()) {
		S_Props prop = f_alloc_键位(key, name);

		g_3D视口键位映射容器[key] = prop;
	}

	C_Widget::G键位映射容器.insert(key);
}

void C_键位映射配置::f_添加2D视口操作键位(S_键位映射* key, std::wstring name) {
	if (g_2D视口键位映射容器.find(key) == g_2D视口键位映射容器.end()) {
		S_Props prop = f_alloc_键位(key, name);

		g_2D视口键位映射容器[key] = prop;
	}

	C_Widget::G键位映射容器.insert(key);
}

void C_键位映射配置::f_添加节点视口操作键位(C_Widget* self, S_键位映射* key, std::wstring name) {
	if (g_节点视口键位映射容器.find(key) == g_节点视口键位映射容器.end()) {
		S_Props prop = f_alloc_键位(key, name);

		g_节点视口键位映射容器[key] = prop;

		switch (key->m_Type) {
			case E_键位映射类型::e_键映射类型_键盘: {
				f_ui_注册键盘快捷键(self, (S_键盘键位映射*)key);
				break;
			}
			default:
				break;
		}
		
		C_Widget::G键位映射容器.insert(key);
	}
}
